<include file="Public/header"/>
<div class="row">
	<div class="col-md-12">
		<form class="layui-form layui-form-pane" action="" autocomplete="off" id="editPassword">
		  <div class="layui-form-item">
			<label class="layui-form-label">原密码：</label>
			<div class="layui-input-inline">
			  <input type="password" name="ypassword" autocomplete="off" lay-verify="required" placeholder="" class="layui-input">
			</div>
		  </div>
		  <div class="layui-form-item">
			<label class="layui-form-label">新密码：</label>
			<div class="layui-input-inline">
			  <input type="password" name="newpassword" autocomplete="off" lay-verify="required" placeholder="" class="layui-input">
			</div>
		  </div>
		  <div class="layui-form-item">
			<label class="layui-form-label">重复新密码：</label>
			<div class="layui-input-inline">
			  <input type="password" name="newpasswordok" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
			</div>
		  </div>
		  <div class="layui-form-item">
			<button class="layui-btn" lay-submit="" lay-filter="add">提交修改</button>
		  </div>
		</form>
	</div>
</div>
<include file="Public/footer"/>
<script>
layui.use(['layer', 'form'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,$ = layui.jquery;
			
  //监听提交
  form.on('submit(add)', function(data){
	$.ajax({
		url:"<{:U('System/editPassword')}>",
		type:"post",
		data:$('#editPassword').serialize(),
		success:function(res){
			if(res.status){
				layer.alert("操作成功", {icon: 6},function () {
					parent.location.reload();
					var index = parent.layer.getFrameIndex(window.name);
					parent.layer.close(index);
				});
			}else{
				layer.msg(res.msg?res.msg:"操作失败!", {icon: 5},function () {
					var index = parent.layer.getFrameIndex(window.name);
					parent.layer.close(index);
				});
				return false;
			}
		}
	});
	return false;
  });
});
</script>
</body>
</html>